package miracle.joker.design.flyweight;

import java.awt.Color;
import java.util.HashMap;
import java.util.Map;

public class LetterFactory {
    private Map<Character, Letter> letters = new HashMap<Character, Letter>();

    public Letter getLetter(char character, int size, Color color, int x, int y) {
        Letter letter = letters.get(character);
        if (letter == null) {
            letter = new Letter(character, size, color, x, y);
            letters.put(character, letter);
        }
        return letter;
    }
}
